package ljl.bilibili.video.vo.request.audience_reactions.like;

import io.swagger.annotations.ApiModelProperty;
import ljl.bilibili.client.pojo.LikeNoticeAddOrDelete;
import ljl.bilibili.entity.video.audience_reactions.like.Like;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * 点赞请求类，用于封装点赞操作的相关信息
 */
@Data
public class LikeRequest {

    @ApiModelProperty("发评论的用户id") 
    private Integer userId;
    @ApiModelProperty("评论所在视频的id")
    private Integer videoId;
    @ApiModelProperty("点赞的评论的id")
    private Integer commentId;

    /**
     * 将点赞请求转换为实体对象
     * @return 转换后的点赞实体对象
     */
    public Like toEntity(){
        Like danmaku = new Like();
        BeanUtils.copyProperties(this, danmaku);
        return danmaku;
    }

    /**
     * 将点赞请求转换为点赞通知对象
     * @return 转换后的点赞通知对象
     */
    public LikeNoticeAddOrDelete toAddOrDeleteNotice(){
        LikeNoticeAddOrDelete likeNotice = new LikeNoticeAddOrDelete();
        BeanUtils.copyProperties(this, likeNotice);
        likeNotice.setSenderId(userId);
        return likeNotice;
    }
}
